home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / smaltalk.lha / smalltalk-1.1.1 / stix / event.st < prev    next >
Text File  |  1991-09-12  |  3KB  |  108 lines

  1. "======================================================================
  2. |
  3. | Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  4. | Written by Steve Byrne.
  5. |
  6. | This file is part of GNU Smalltalk.
  7. |
  8. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  9. | under the terms of the GNU General Public License as published by the Free
  10. | Software Foundation; either version 1, or (at your option) any later version.
  11. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  12. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14. | details.
  15. | You should have received a copy of the GNU General Public License along with
  16. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  17. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  18. |
  19.  ======================================================================"
  20.  
  21.  
  22. "
  23. |     Change Log
  24. | ============================================================================
  25. | Author       Date       Change 
  26. | sbyrne     24 May 90      created.
  27. |
  28. "
  29.  
  30. Object subclass: #XEvent
  31.        instanceVariableNames: 'sequenceNumber'
  32.        classVariableNames: 'EventMap'
  33.        poolDictionaries: 'XGlobals'
  34.        category: 'X hacking'
  35. !
  36.  
  37. !XEvent methodsFor: 'accessing'!
  38.  
  39. sequenceNumber
  40.     ^sequenceNumber
  41. !
  42.  
  43. mappedId: anId
  44.     ^Registry at: anId
  45.           ifAbsent: [ nil ]
  46. !!
  47.  
  48.  
  49. FileStream fileIn: 'Xevt.st'!
  50.  
  51. !XEvent class methodsFor: 'subinstance creation'!
  52.  
  53. initialize
  54.     | namePrefixes i sym |
  55.     namePrefixes _ #(
  56. KeyPress            "2"
  57. KeyRelease            "3"
  58. ButtonPress            "4"
  59. ButtonRelease            "5"
  60. MotionNotify            "6"
  61. EnterNotify            "7"
  62. LeaveNotify            "8"
  63. FocusIn                "9"
  64. FocusOut            "10"
  65. KeymapNotify            "11"
  66. Expose                "12"
  67. GraphicsExposure        "13"
  68. NoExposure            "14"
  69. VisibilityNotify        "15"
  70. CreateNotify            "16"
  71. DestroyNotify            "17"
  72. UnmapNotify            "18"
  73. MapNotify            "19"
  74. MapRequest            "20"
  75. ReparentNotify            "21"
  76. ConfigureNotify            "22"
  77. ConfigureRequest        "23"
  78. GravityNotify            "24"
  79. ResizeRequest            "25"
  80. CirculateNotify            "26"
  81. CirculateRequest        "27"
  82. PropertyNotify            "28"
  83. SelectionClear            "29"
  84. SelectionRequest        "30"
  85. SelectionNotify            "31"
  86. ColormapNotify            "32"
  87. ClientMessage            "33"
  88. MappingNotify            "34"
  89. ).
  90.     EventMap _ Array new: namePrefixes size.
  91.     i _ 2.
  92.     namePrefixes do: 
  93.     [ :prefix | sym _ (prefix, 'Event') asSymbol.
  94.             EventMap at: i put: (Smalltalk at: sym 
  95.                            ifAbsent: [ nil ]).
  96.             i _ i + 1 ]
  97. !
  98.  
  99. newFrom: aStream type: type
  100.     | class | 
  101.     class _ EventMap at: type.
  102.     ^class newFrom: aStream
  103. !!
  104.  
  105. XEvent initialize!
  106.